/*
 * txdnet.cn tonydon
 * by netbeans ide 7.2
 */
package cn.txdnet.txweb.basedao;

/**
 *
 * @author tangxiaodong
 */
public abstract class AbstractSqlSessionMgr<S> implements SqlSessionMgr<S> {
    /**
     * 配置文件
     */
    protected String configFile;
    /**
     * 默认事务隔离级别
     */
    protected TransIsoLevel defaultTransIsoLevel;
    
    /**
     * 线程局部存储对象，为每个线程提供不同的SQL Session 对象
     */
    protected final ThreadLocal<S> localSession = new ThreadLocal<S>();
    
    /**
     * 加载SqlSessionMgr 默认事务隔离级别
     */
    abstract protected void loadDefaultTransIsoLevel();
    
    @Override
    public TransIsoLevel getDefaultTransIsoLevel(){
        return defaultTransIsoLevel;
    }
    
    @Override
    public S currentSession(){
        return localSession.get();
    }
    
    @Override
    public String getConfigFile(){
        return configFile;
    }
    
}
